package com.yakumosakura.yakumoblade.registry.creativetab;

import com.yakumosakura.yakumoblade.compat.YATouHouMaidItem;
import com.yakumosakura.yakumoblade.registry.ItemRegistry;
import mods.flammpfeil.slashblade.SlashBlade;
import mods.flammpfeil.slashblade.SlashBladeCreativeGroup;
import mods.flammpfeil.slashblade.init.SBItems;
import mods.flammpfeil.slashblade.item.ItemSlashBlade;
import mods.flammpfeil.slashblade.registry.slashblade.SlashBladeDefinition;
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import static com.yakumosakura.yakumoblade.Yakumoblade.MODID;
import static com.yakumosakura.yakumoblade.compat.YATouHouMaidItem.YELLOW_FOX;

public class ItemTab {

    public static final DeferredRegister<CreativeModeTab> REGISTRY = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
    public static final RegistryObject<CreativeModeTab> YAKUMOTAB = REGISTRY.register("yakumobladeitem",
            () -> CreativeModeTab.builder().title(Component.translatable("item_group.yakumoblade.yakumobladeitem")).icon(() -> new ItemStack(ItemRegistry.UMLE.get())).displayItems((parameters, tabData) -> {
                        tabData.accept(ItemRegistry.UMLE.get());
                        tabData.accept(ItemRegistry.Star_Soul_Crystal.get());
                        tabData.accept(ItemRegistry.StarTreasurescripture.get());
                        tabData.accept(ItemRegistry.powercore.get());
                        tabData.accept(ItemRegistry.powercoreex.get());
//                        tabData.accept(ItemRegistry.ghost_ingot.get());
//                        tabData.accept(ItemRegistry.red_eyes.get());
//                        tabData.accept(ItemRegistry.legend_od_the_star.get());
//                        tabData.accept(ItemRegistry.ungod_s_crown.get());
//                        tabData.accept(ItemRegistry.beyond_flower.get());
//                        tabData.accept(ItemRegistry.red_iron_ingot.get());
//                        tabData.accept(ItemRegistry.ark_metal_ingot.get());
//                        tabData.accept(ItemRegistry.blaze_umle.get());
//                        tabData.accept(ItemRegistry.the_god_s_soul.get());
//                        tabData.accept(ItemRegistry.blood_sakura.get());
//                        tabData.accept(ItemRegistry.westward_youkai_wood.get());
//                        tabData.accept(ItemRegistry.metal_ingot.get());
                    })

                    .build());



    public static final RegistryObject<CreativeModeTab> YASlashbladeTouHou = REGISTRY.register(MODID+"_slashblade_touhou",
            () -> CreativeModeTab.builder()
                    .withTabsBefore(SlashBladeCreativeGroup.SLASHBLADE_GROUP.getId())
                    .title(Component.translatable("item_group."+MODID+"."+MODID+"_slashblade_touhou")).icon(() -> {
                        ItemStack stack = new ItemStack(SBItems.slashblade);
                        stack.getCapability(ItemSlashBlade.BLADESTATE).ifPresent(s -> {
                            s.setModel(new ResourceLocation(MODID, "model/named/sange/sange.obj"));
                            s.setTexture(new ResourceLocation(MODID, "model/named/sange/yakumosakurafinal.png"));
                        });
                        return stack;
                    })
                    .displayItems((parameters, tabData) -> {

                    })
                    .build());
    public static final RegistryObject<CreativeModeTab> YASlashbladeStar = REGISTRY.register(MODID+"_slashblade_star",
            () -> CreativeModeTab.builder()
                    .withTabsBefore(SlashBladeCreativeGroup.SLASHBLADE_GROUP.getId())
                    .title(Component.translatable("item_group."+MODID+"."+MODID+"_slashblade_star")).icon(() -> {
                        ItemStack stack = new ItemStack(SBItems.slashblade);
                        stack.getCapability(ItemSlashBlade.BLADESTATE).ifPresent(s -> {
                            s.setModel(new ResourceLocation(MODID, "model/maker_sword/dark_raven.obj"));
                            s.setTexture(new ResourceLocation(MODID, "model/maker_sword/star_of_dinzeer.png"));
                        });
                        return stack;
                    })
                    .displayItems((parameters, tabData) -> {

                    })
                    .build());
    public static final RegistryObject<CreativeModeTab> YASlashbladeHexGram = REGISTRY.register(MODID+"_slashblade_hexgram",
            () -> CreativeModeTab.builder()
                    .withTabsBefore(SlashBladeCreativeGroup.SLASHBLADE_GROUP.getId())
                    .title(Component.translatable("item_group."+MODID+"."+MODID+"_slashblade_hexgram")).icon(() -> {
                        ItemStack stack = new ItemStack(SBItems.slashblade);
                        stack.getCapability(ItemSlashBlade.BLADESTATE).ifPresent(s -> {
                            s.setModel(new ResourceLocation(MODID, "model/hexgram/five/five.obj"));
                            s.setTexture(new ResourceLocation(MODID, "model/hexgram/five/five.png"));
                        });
                        return stack;
                    })
                    .displayItems((parameters, tabData) -> {

                    })
                    .build());

    public static final RegistryObject<CreativeModeTab> YASlashblade = REGISTRY.register(MODID+"_slashblade",
            () -> CreativeModeTab.builder()
                    .withTabsBefore(SlashBladeCreativeGroup.SLASHBLADE_GROUP.getId())
                    .title(Component.translatable("item_group."+MODID+"."+MODID+"_slashblade")).icon(() -> {
                        ItemStack stack = new ItemStack(SBItems.slashblade);
                        stack.getCapability(ItemSlashBlade.BLADESTATE).ifPresent(s -> {
                            s.setModel(new ResourceLocation(MODID, "model/named/custom/vergil/model.obj"));
                            s.setTexture(new ResourceLocation(MODID, "model/named/custom/vergil/texture.png"));
                        });
                        return stack;
                    })
                    .displayItems((parameters, tabData) -> {

                    })
                    .build());



    public static void register(IEventBus e){
        REGISTRY.register(e);
    }
}
